package xh;

/**
 * Created by Administrator on 2016/7/6.
 */
public enum Command {

    Download(1), Ask(2);

    private int cmdCode;

    private Command(int cmdCode) {
        this.cmdCode = cmdCode;
    }

    public static Command cmd(int cmdCode) {
        for (Command c : Command.values()) {
            if (c.cmdCode == cmdCode) {
                return c;
            }
        }

        return null;
    }

    public int code() {
        return cmdCode;
    }
}
